<?php

use Dingo\Api\Routing\Router;
use App\Http\Controllers\AuthController;

$api = app(Router::class);

$api->version('V1',function ($api){

    $api->group([
        'namespace' => 'App\Http\Controllers',
        'prefix' => 'user',
    ],function ($api){
        $api->post('login','AuthController@login')->name('login');
        $api->group([
            'middleware' => ['jwt.auth']
        ],function ($api){
            //退出登录
            $api->get('logout','AuthController@logout');
            //个人信息
            $api->get('me','AuthController@me');
            //权限
            $api->get('permissions','AuthController@getPermissions');
        });

    });

});


//$api->version('v1', static function ($api) {
//
//    /**
//     * 登录.
//     */
//    $api->group([
//        'prefix' => 'auth',
//    ], static function ($api) {
//        $api->post('login', 'AuthController@login');
//        $api->post('logout', 'AuthController@logout');
//        $api->post('refresh', 'AuthController@refresh');
//        $api->post('me', 'AuthController@me');
//    });
//});
